cmake_minimum_required(VERSION 2.8.4)

SET(PRJ_NAME 				posixthread)

SET(PRJ_ROOTDIR				${CMAKE_CURRENT_SOURCE_DIR} )

PROJECT(${PRJ_NAME} 		C CXX)

MESSAGE(STATUS "Building POSIX Thread demos.")
if(OS_TYPE STREQUAL Linux)
	MESSAGE(STATUS "@@@ Host platform: Linux")
	ADD_DEFINITIONS(-DOS_Linux)
endif()

INCLUDE_DIRECTORIES( 
	"${PRJ_ROOTDIR}"
)

LINK_DIRECTORIES(
	"${PRJ_ROOTDIR}/build"
)
	
	SET(cflags	-std=gnu99)
	ADD_DEFINITIONS(${cflags})

	SET(SRCLIST_demo1
		${PRJ_ROOTDIR}/thr.c
		${PRJ_ROOTDIR}/demo/demo1.c
	)
	ADD_EXECUTABLE(demo1  ${SRCLIST_demo1} )
	TARGET_LINK_LIBRARIES(demo1 -lpthread)